/*

//定义一个猫类
class Cat{
    String name;
    int age;
    String color;

    public Cat(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    public void mew(){
        System.out.println(this.name + "正在喵喵喵~");
    }
}

//定义一个狗类
class Dog{
    String name;
    int age;
    String color;

    public Dog(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    public void barks(){
        System.out.println(this.name + "正在汪汪汪~");
    }
}
*/

//定义动物类（父类）
class Animal{
    String name;
    int age;
    String color;
}

//定义狗类（子类）
class Dog extends Animal{
    public void barks(){
        System.out.println(this.name + "正在汪汪汪~");
    }
}

//定义猫类
class Cat extends Animal{
    public void mew(){
        System.out.println(this.name + "正在喵喵喵~");
    }
}
public class test {
    public static void main(String[] args) {
        Dog dog = new Dog();
        // dog类中并没有定义任何成员变量，name和age属性肯定是从父类Animal中继承下来的
        System.out.println(dog.name);
        System.out.println(dog.age);
        dog.barks();
    }

}



